package com.wdh.cloud.api.controller;

import com.wdh.cloud.api.client.OrderClient;
import com.wdh.cloud.api.client.ProductClient;
import com.wdh.cloud.domain.order.OrderEntity;
import com.wdh.cloud.domain.product.ProductEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderClient orderClient;

    @Autowired
    private ProductClient productClient;

    @RequestMapping("/detail")
    public Object orderDetail(){
        OrderEntity order = orderClient.getById(1);
        ProductEntity product = productClient.getById(1);

        Map<String,Object> rsMap = new HashMap<>();
        rsMap.put("order",order);
        rsMap.put("product",order);
        return rsMap;
    }
}
